package com.lfy.Factor.comm;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class CaoFacotry {
    private List<CaoService> list = new ArrayList<>();
    private static CaoFacotry facotry = new CaoFacotry();

    public static CaoFacotry getInstance(){
        return facotry;
    }

    public void register(CaoService caoService){
        list.add(caoService);
    }

    public String parse(Integer code){
        for (CaoService caoService : list) {
            if(caoService.parse(code)){
                return caoService.name();
            }
        }

        return null;
    }


}
